package Springboot.Controller;

import Springboot.Utils.Result;
import Springboot.domain.NewsHeadline;
import Springboot.domain.NewsType;
import Springboot.domain.news.pojo;
import Springboot.mapper.NewsHeadlineMapper;
import Springboot.service.impl.NewsHeadlineServiceImpl;
import Springboot.service.impl.NewsTypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("portal")
public class portalController {
    @Autowired
    NewsHeadlineServiceImpl newsHeadlineService;
    @Autowired
    NewsTypeServiceImpl TypeService;



    @GetMapping("findAllTypes")
    public Result findAllTypes() {
        List<NewsType> list = TypeService.list();
        return  Result.ok(list);
    }

@PostMapping("findNewsPage")
    public Result findNewsPage(@RequestBody pojo page) {
        Result result=newsHeadlineService.findNewsPage(page);
        return  result;
    }
@PostMapping("showHeadlineDetail")
    public Result showHeadlineDetail(Integer hid) {
        Result result=newsHeadlineService.showHeadlineDetail(hid);
        return result;
    }
}
